import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_excel('某公司各部门1—2月份实际支出.xlsx')
plt.figure(figsize=(8,4))
plt.rcParams['font.sans-serif'] = 'Simhei'
plt.title('某公司各部门1—2月份实际支出簇状柱形图')
plt.ylabel('实际支出(元)')
x_data = np.arange(len(df['部门']))
height_data = []
height_data.append(df['1月'])
height_data.append(df['2月'])
width = 0.4
for i in range(len(height_data)):
    x=x_data+i*width
    height=height_data[i]
    plt.bar(x,height,width)
    for a, b in zip(x, height):
        plt.text(a, b, '%d' %b, ha='center')
plt.xticks(x_data+0.2,df['部门'])
plt.legend(('1月','2月'))
plt.show()